package com.wx.app.card.controller;

import com.wx.app.card.dao.mapper.FriendMapper;
import com.wx.app.card.domain.vo.Result;
import com.wx.app.card.utils.CacheUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RestController;

/**
 * 类功能描述：
 *
 * @author：刘富国
 * @createTime：2019/7/30 19:43
 */
@Api(tags = "B排行榜")
@Slf4j
@RestController
public class RankController extends BaseController {

    @Autowired
    private FriendMapper friendMapper;


    /**
     * 好友排行榜
     */
    @ApiOperation(value = "好友排行榜")
    @PostMapping("/ranking/friends")
    public Result friends(@RequestHeader String token) {
        return success(friendMapper.getFriendRankSerial(CacheUtils.getUserId(token)));
    }

    /**
     * 世界排行榜
     */
    @ApiOperation(value = "世界排行榜")
    @PostMapping("/ranking/all")
    public Result all(@RequestHeader String token) {
        return success(friendMapper.getAllRankSerial());
    }
}
